﻿<phone:PanoramaItem x:Class="PhoneGuitarTab.UI.Views.PanaromaItems.Discover"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Command="clr-namespace:PhoneCore.Framework.Views.Commands;assembly=PhoneGuitarTab.Core"
                    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"   
                    xmlns:ring="clr-namespace:InTheHand.UI.Xaml.Controls;assembly=InTheHand.UI.Xaml.Controls.ProgressRing"                  
                    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                    xmlns:Infrastructure="clr-namespace:PhoneGuitarTab.UI.Infrastructure"
                    xmlns:local="clr-namespace:PhoneGuitarTab.UI.CommonResources"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    DataContext="{Binding Discover, Source={StaticResource Locator}}"
                    Header="{Binding Path=LocalizedResources.Discover_Header, Source={StaticResource LocalizedStrings}}"
                    
                    mc:Ignorable="d">
   
    <phone:PanoramaItem.Resources>
        <Infrastructure:ImageUrlToUriConverter x:Key="ImageUrlToUriConverter"/>
        <DataTemplate x:Key="DiscoverHeaderTemplate">
            <TextBlock Margin="10,10,10,10"
                                   FontFamily="{StaticResource PhoneFontFamilyBold}"
                                   FontSize="16"
                                   Foreground="{StaticResource PhoneForegroundBrush}"
                                   Style="{StaticResource PhoneTextLargeStyle}"
                                 
                                   Text="{Binding Path=LocalizedResources.Discover_SuggestionsTitle, Source={StaticResource LocalizedStrings}}" />
           
        </DataTemplate>
        
        <DataTemplate x:Key="CollectionHeaderDataTemplate">
            <Grid  Margin="0,10,0,10" HorizontalAlignment="Left" Width="400" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <StackPanel  VerticalAlignment="Bottom" HorizontalAlignment="Left">
                    <TextBlock
                                   FontFamily="{StaticResource PhoneFontFamilySemiBold}"
                                   FontSize="22"
                                   Foreground="{StaticResource PhoneForegroundBrush}"
                                   Style="{StaticResource PhoneTextLargeStyle}"  
                                    TextWrapping="Wrap"
                                   Text="{Binding Item2.Name}" />
                </StackPanel>
              
            </Grid>
        </DataTemplate>     
        <DataTemplate x:Key="SuggestedArtistDataTemplate">
            <Grid Margin="10,10,10,10" Height="300" Width="300" HorizontalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Image VerticalAlignment="Center" HorizontalAlignment="Center" 
                              Stretch="UniformToFill" MaxHeight="300" MaxWidth="300" Opacity="0.1" Source="/Images/applogo.png">
                </Image>
                <Image VerticalAlignment="Center" HorizontalAlignment="Center"
                           Stretch="UniformToFill"
                           Visibility="Visible" MaxHeight="300" MaxWidth="300" Opacity="0.8">
                    <Image.Source >
                        <BitmapImage UriSource="{Binding Item2.ExtraLargeImageUrl, Converter={StaticResource ImageUrlToUriConverter}}"  />
                    </Image.Source>
                </Image>
                <StackPanel  VerticalAlignment="Bottom" HorizontalAlignment="Left">
                    <TextBlock Margin="5"
                                   FontFamily="{StaticResource PhoneFontFamilyBold}"
                                   FontSize="20"
                                   Foreground="White"
                                   TextWrapping="Wrap"
                                   Style="{StaticResource PhoneTextLargeStyle}"
                                   Text="{Binding Item2.Name}" />
                    
                </StackPanel>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="SuggestedGenreDataTemplate">
            <Grid Margin="10,10,10,10" Height="180" Width="400" HorizontalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
              
                <Image VerticalAlignment="Center" HorizontalAlignment="Center"
                           Stretch="UniformToFill"
                           Visibility="Visible" MaxHeight="180" MaxWidth="400" Opacity="0.90">
                    <Image.Source >
                        <BitmapImage UriSource="{Binding Item2.ExtraLargeImageUrl, Converter={StaticResource ImageUrlToUriConverter}}"  />
                    </Image.Source>
                </Image>
                <StackPanel  VerticalAlignment="Top" HorizontalAlignment="Left">
                    <TextBlock Margin="10,0,0,0"
                                   FontFamily="{StaticResource PhoneFontFamilyBold}"
                                   FontSize="30"
                                   Foreground="White"
                                   TextWrapping="Wrap"
                                   Style="{StaticResource PhoneTextLargeStyle}"
                                   Text="{Binding Item2.Name}"/>
                </StackPanel>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="SelectingTemplate">
            <local:ItemTemplateSelector Content="{Binding}"
                                    SuggestedBandTemplate="{StaticResource SuggestedArtistDataTemplate}"
                                    BrowseByGenreItemTemplate="{StaticResource SuggestedGenreDataTemplate}"
                                    CollectionHeaderTemplate="{StaticResource CollectionHeaderDataTemplate}"  />
        </DataTemplate>
    </phone:PanoramaItem.Resources>
    <Grid>

        <phone:LongListSelector x:Name="SuggestedGroupList"  Margin="{Binding Startup.ListMargin, Source={StaticResource Locator}}" 
                              toolkit:TiltEffect.IsTiltEnabled="True"
                              IsGroupingEnabled="False" LayoutMode="List" 
                              HideEmptyGroups="True"                            
                              ItemTemplate="{StaticResource SelectingTemplate}"
                              ItemsSource="{Binding SuggestedItems}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Tap">
                    <Command:ExecuteCommandAction Command="{Binding GoTo}" CommandParameter="{Binding ElementName=SuggestedGroupList}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
           
        </phone:LongListSelector>
        <ring:ProgressRing x:Name="ProgressRing" Height="60" Width="60" Margin="0,1800,0,0"  IsActive="{Binding IsLoading}"></ring:ProgressRing>
        <TextBlock              Margin="0,80"
                                HorizontalAlignment="Center"
                                     FontSize="24"
                                    Opacity="0.5"
                                   FontFamily="{StaticResource PhoneFontFamilyBold}"                            
                                   Foreground="{StaticResource PhoneForegroundBrush}"
                                   Style="{StaticResource PhoneTextLargeStyle}"
                                   TextWrapping="Wrap"
                                   Visibility="Collapsed"
                                   Text="{Binding Path=LocalizedResources.Discover_DiscoverTip, Source={StaticResource LocalizedStrings}}" />
       
    </Grid>
   
</phone:PanoramaItem>